<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let data = {
      message: '测试数据'
    }

    console.log(data);

    Object.defineProperty(data, 'message', {
      configurable: true, // 是否可删除
      enumerable: true, // 是否可遍历
      get(){
        console.log('get...');
        return '测试数据';
      },
      set(newValue){
        console.log('set...', newValue);
      }
    })

    data.message = '修改数据';
    console.log(data);

    // delete data.message;

    for(var key in data){
      console.log(data[key]);
    }
  </script>
</body>
</html>